﻿<frameworkControls:NavigatePhoneApplicationPage 
    x:Class="Mal.WP7.TimeClock.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    xmlns:local="clr-namespace:Mal.WP7.TimeClock"
    xmlns:ViewModels="clr-namespace:Mal.WP7.TimeClock.ViewModels"
    xmlns:frameworkControls="clr-namespace:mal.WP7.Framework.Controls;assembly=mal.WP7.Framework"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True">
    <frameworkControls:NavigatePhoneApplicationPage.DataContext>
        <ViewModels:MainViewModel />
    </frameworkControls:NavigatePhoneApplicationPage.DataContext>
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <local:HeaderBackground Grid.RowSpan="2" VerticalAlignment="Top" />

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" 
                    Style="{StaticResource TitlePanelStyle}">
            <TextBlock x:Name="ApplicationTitle" Text="{Binding Text.ApplicationName, Source={StaticResource Resource}}" 
                       Style="{StaticResource PhoneTextNormalStyle}"/>

            <TextBlock x:Name="PageTitle" Text="{Binding Text.MainPageSubtitle, Source={StaticResource Resource}}"
                       Margin="9,-7,0,0" 
                       Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel"  Grid.Row="1" Margin="12,0,12,0">

            <StackPanel>
                <StackPanel.Resources>
                    <Style TargetType="Border">
                        <Setter Property="Margin" Value="5" />
                        <Setter Property="BorderThickness" Value="1" />
                        <Setter Property="CornerRadius" Value="5" />
                        <Setter Property="BorderBrush" Value="{StaticResource PhoneContrastBackgroundBrush}" />
                    </Style>
                    
                    <Style TargetType="Button" x:Key="timeButton">
                    </Style>

                    <Style TargetType="StackPanel" x:Key="timeStackPanel">
                        
                    </Style>
                </StackPanel.Resources>
                <Border>
                    <StackPanel>
                        <toolkit:DatePicker Value="{Binding CurrentDate}" />
                    </StackPanel>
                </Border>

                <Border>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="100" />
                        </Grid.ColumnDefinitions>

                        <toolkit:TimePicker Grid.Row="0" Grid.Column="0"  Value="{Binding CurrentDay.BeginMorning}"    />
                        <Button Grid.Row="0" Grid.Column="1"  Content="X" 
                                Style="{StaticResource timeButton}"
                                Command="{Binding BeginMorningCommand}" />

                        <toolkit:TimePicker Grid.Row="1" Grid.Column="0"   Value="{Binding CurrentDay.EndMorning}"  />
                        <Button Grid.Row="1" Grid.Column="1"  Content="X" 
                                Style="{StaticResource timeButton}"
                                Command="{Binding EndMorningCommand}" />
                    </Grid>                       
                </Border>

                <Border>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="100" />
                        </Grid.ColumnDefinitions>

                        <toolkit:TimePicker Grid.Row="0" Grid.Column="0"   Value="{Binding CurrentDay.BeginAfternoon}"    />
                        <Button Grid.Row="0" Grid.Column="1"  Content="X" 
                                Style="{StaticResource timeButton}"
                                Command="{Binding BeginAfternoonCommand}" />

                        <toolkit:TimePicker Grid.Row="1" Grid.Column="0"   Value="{Binding CurrentDay.EndAfternoon}"  />
                        <Button Grid.Row="1" Grid.Column="1"  Content="X" 
                                Style="{StaticResource timeButton}"
                                Command="{Binding EndAfternoonCommand}" />
                    </Grid>
                </Border>
            </StackPanel>
        </Grid>
    </Grid>

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
             <!--<shell:ApplicationBarIconButton IconUri="/Images/appbar.feature.settings.rest.png" 
                                            Text="paramètres" 
                                            Click="OnApplicationBarIconButtonClick"/>-->
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem x:Name="aboutButton"
                                          Text="about"
                                          Click="OnAboutButtonClick" />
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</frameworkControls:NavigatePhoneApplicationPage >